# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=libdab
_pkgname=dab-cmdline
pkgver=dab.cmdline.0.8.r341.ga1bad4c
pkgrel=1
pkgdesc='DAB decoding library.'
arch=('x86_64' 'aarch64')
url='https://github.com/JvanKatwijk/dab-cmdline'
license=('GPL-2.0-or-later')
depends=('fftw' 'faad2')
makedepends=('cmake' 'git')
provides=('libdab_lib.so')
source=("git+https://github.com/JvanKatwijk/$_pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $_pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

build() {
  cd $_pkgname

  cmake -B build -S library \
    -Wno-dev \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr

  make -C build
}

package() {
  cd $_pkgname

  make -C build DESTDIR="$pkgdir" install
}

